__author__ = 'st316'
'''
Given an array of integers, every element appears twice except for one. Find that single one.

Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

Use xor
'''


class Solution:
    # @param A, a list of integer
    # @return an integer
    def singleNumber(self, A):
        r = 0
        for x in A:
            r = r ^ x
        return r


if __name__ == '__main__':
    s = Solution()
    print s.singleNumber([1, 1, 2, 3, 2])